/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Interface;

import java.awt.Color;
import java.awt.Font;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.vecmath.Color3f;

/**
 *
 * @author agnieszka
 */
public class HelpPanel {
    public JFrame okodane;
    private JTextArea opis;
    private JScrollPane zwijak;
String pawnt="  THE PAWN\n\n The pawn moves differently regarding\n whetherit moves to an empty square\n or whether it takes a piece of the opponent.\n When a pawn does not take,\n it moves one square straight forward.\n";
String bishopt=" THE BISHOP\n\n The bishop moves in a straight diagonal line.\n The bishop may also not jump over other pieces.\n";
String rookt=" THE ROOK\n\n The rook moves in a straight line,\n horizontally or vertically.\n The rook may not jump over other pieces, that is:\n"
    +" all squares between the square\n where the rook starts its move\n and where the rook ends its move must be empty.\n";
String queent="  THE QUEEN\n\n The queen has the combined moves of\n the rook and the bishop,\n i.e. the queen may move in any straight line," +
        "\nhorizontal, vertical, or diagonal.";
String knigtht="  THE KNIGHT\n\n The knight makes a move that consists of\n first one step in a horizontal or vertical direction\n and then one step diagonally in\n an outward direction.\n" +
        "The knight jumps: it is allowed that\n the first square that the knight passes over\n is occupied by an arbitrary piece";
String kingt="  THE KING\n\n The king moves one square in any direction,\n horizontally, vertically, or diagonally.\n"
      +"The king is the most important piece of the game,\n and moves must be made in such a way\nthat the king is never in check";
String castt="  THE CASTLING\n\n There is one special type of move,\n made by a king and rook simultaneously,\n called castling:\n"+
        "the king moves two squares towards the rook,\n and the rook moves over the king to the next square\n"+
        "The king that makes the castling move has not yet moved in the game.\n"+
    "The rook that makes the castling move has not yet moved in the game.\n"+
    "The king is not in check.\n"+
    "The king does not move over a square\n that is attacked by an enemy piece during the castling move.\n"+
    "The king does not move to a square\n that is attacked by an enemy piece during the castling move.\n"+
    "All squares between the rook and king\n before the castling move are empty."+
    "The King and rook must occupy the same rank (or row).";
String passt="  THE EN-PASSANT.\n\n When a pawn makes a double step from\n the second row to the fourth row,\n and there is an enemy pawn on an adjacent square\n"+
        "on the fourth row, then this enemy pawn\n in the next move may move diagonally\n to the square that was passed over by\n the double-stepping pawn,\n"+
        "which is on the third row.\nI n this same move, the double-stepping pawn is taken.\n This taking en-passant must be done directly:\n"+
        "if the player who could take en-passant does not\n do this in the first move after the double step\n this pawn cannot be taken anymore\n by an en-passant move.";
String promote="  THE PROMOTE\n\n When a player moves a pawn to the last row of the board\n the replaces the pawn by a queen, rook,\n knight, " +
        "or bishop (of the same color).\n Usually, players will promote the pawn to a queen,\n but the other types of pieces are also allowed.";
String stalmet="  THE STALEMATE\n\n When a player cannot make any legal move,\n but he is not in check,\n then the player is said to be stalemated.";
String matet=" THE MATE\n\n When a player is in check,\n and he cannot make a move such that after the move,\n the king is not in check, then he is mated.\n The player that is mated lost the game,\n and the player that mated him won the game. ";
String checkt="  THE CHECK\n\nWhen the king of a player can be taken by\na piece of the opponent,\none says that the king is in check.";



    HelpPanel(){
     
    }


    public void instruction_window() {

                okodane = new JFrame("Instruction");                            //parameters of instruction's window
                okodane.setBounds(200, 50, 600, 640);
                okodane.setResizable(false);
       

                 opis = new JTextArea();
                 opis.setEditable(false);
                 opis.setBounds(170,170,360,360);
                 opis.setBackground(new Color(0,0,0));
                 opis.setForeground(Color.white);
                
                 Font cz = new Font("Times New Roma", 20, 20);
                 opis.setFont(cz);

                 String text = new String();
                     text =  "\n                    THE RULES OF CHESS\n\n " +
                             " Chess is a game, played by two players.\n One player plays with the white pieces, \n the second player plays with the black pieces. \n" +
                             " Each player has sixteen pieces in the beginning of the game:\n one king, one queen, two rooks, two bishops,\n two knights and eight pawns. \n\n"+
                             "\n\n                    "+checkt+"\n\n                    "+matet+"\n\n                    "+stalmet+"\n\n                    "+castt+"\n\n                    "+passt+"\n\n                    "+promote;
                            

                 opis.setText(text);

                zwijak = new JScrollPane(opis);
                zwijak.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
                zwijak.setBounds(170,170,20,360);


                okodane.add(zwijak);

               
            }

    void getInstr(char c) {                                                      //information for "key-h help" depends on actual figures



        switch(c){

            case 'r': JOptionPane.showMessageDialog(null,"\n  "+rookt);
                        break;

            case 'R' : JOptionPane.showMessageDialog(null,"\n  "+rookt);
                        break;
            case 'n': JOptionPane.showMessageDialog(null,"\n  "+knigtht);
                        break;

            case 'N' : JOptionPane.showMessageDialog(null,"\n  "+knigtht);
                        break;
            case 'b': JOptionPane.showMessageDialog(null,"\n  "+ bishopt);
                        break;

            case 'B' : JOptionPane.showMessageDialog(null,"\n  "+ bishopt);
                        break;
            case 'q': JOptionPane.showMessageDialog(null,"\n  "+queent);
                        break;

            case 'Q' : JOptionPane.showMessageDialog(null,"\n  "+queent);
                        break;
             case 'k': JOptionPane.showMessageDialog(null,"\n  "+kingt);
                        break;

            case 'K' : JOptionPane.showMessageDialog(null,"\n  "+kingt);
                        break;
            case 'p': JOptionPane.showMessageDialog(null,"\n  "+pawnt);
                        break;

            case 'P' : JOptionPane.showMessageDialog(null,"\n  "+pawnt);
                        break;

            default: break;
       }

        
    }

}
